package ar.com.faccioli.utils;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.transaction.annotation.Transactional;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.util.Composer;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zkplus.databind.DataBinder;

import ar.com.faccioli.adminSistema.model.UsuarioModel;
import ar.com.faccioli.adminSistema.model.bean.Usuario;

@Transactional
public class GenericController extends GenericForwardComposer implements
		Composer {

	/**
	 * Composer
	 */
	protected DataBinder binder;

	/**
	 * Variables de la Vista
	 */

	// INYECCIONES DE SPRING
	@Resource(name = "usuarioModel")
	protected UsuarioModel usuarioModel;

	@Override
	public void doAfterCompose(Component comp) throws Exception {
		super.doAfterCompose(comp);
	}

	/**
	 * Model para el combobox Aprobo
	 * 
	 * @return
	 */
	public List<Usuario> getListaUsuario() {
		return usuarioModel.getListaUsuarios();
	}

	protected Usuario getUsuarioConectado() {
		return (Usuario) usuarioModel.getUsuario(execution.getUserPrincipal().getName());
	}

	
	
}
